package com.sl.au.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.Account;
import com.sl.au.entity.Goods;
import com.sl.au.entity.User;

public interface GoodsRepository extends JpaRepository<Goods, String> {

	@Query("select a from Goods a where a.goodsName like %?1% ")
	Page<Goods> getByKey(String key, Pageable pageable);

	@Query("select count(1) from Goods a where a.goodsName like %?1% ")
	int getCountByKey(String key);

	@Query("select count(1) from Goods ")
	int getCount();

	@Query("select a from Goods a where a.colsingDate = null or a.colsingDate >= ?1 ")
	Page<Goods> getGoodsByDate(Date colsingDate, Pageable pageable);
	
}